package thread;

import java.util.function.Consumer;

/**
 * @author zxl
 * @version 1.0
 * @date 2021/10/26 16:40
 * 函数式接口：一个接口内只有一个抽象方法
 */
public class Lamda {
    public static void main(String[] args) {
       //匿名内部类
        Like like = new Like(){
            @Override
            public void eat() {
                System.out.println("吃饭呢");
            }
        };
        like.eat();

        //lamda
        like = ()->{
            System.out.println("吃饭");
        };
        like.eat();


        Like2 like2 = (num) -> System.out.println("喝水"+10);
        like2.drink(10);


        new Thread(()-> System.out.println());

        new Thread(new Runnable() {
            @Override
            public void run() {

            }
        });

    }
}
//接口
interface Like{
    void eat();
}
//实现类
class Man implements Like{
    @Override
    public void eat() {
        System.out.println("吃");
    }
}

interface Like2{
    void drink(int num);
}

